package ts.test.service.impl;

import org.apache.log4j.Logger;
import ts.test.service.Buyer;

public class IntermerdiaryImpl implements Buyer {
    private Logger logger = Logger.getLogger(IntermerdiaryImpl.class);
    /**
     * 模拟一个代理
     */
    private Buyer target;

    public IntermerdiaryImpl(Buyer target) {
        this.target = target;
    }

    /**
     * 对目标对象业务进行代理
     */
    @Override
    public String havealook() {
        before();
        String feedback = target.havealook(); //执行目标对象的实际业务
        after();
        return "看房记录：买家反馈“" + feedback + "”";
    }

    private void after() {
        logger.info("后期跟踪。");
        logger.info("和买家沟通意见。");
    }

    private void before() {
        logger.info("前期准备。");
        logger.info("查找房源。");
        logger.info("和卖家沟通时间。");
    }
}
